package com.mike.uaa.web;

/**
 * @author zhangz
 */
public class ServiceException extends RuntimeException implements DataResponse {

    private static final long serialVersionUID = -3435528093859682944L;


    private final DataResponse dataResponse;

    public ServiceException() {
        // : 2023/9/24 业务异常
        this.dataResponse = ResponseBuilder.fail(this.getMessage());
    }

    public ServiceException(DataResponse DataResponse) {
        this.dataResponse = DataResponse;
    }

    public ServiceException(Integer status, String message) {
        this.dataResponse = DataResponse.getInstance(status, message);
    }

    @Override
    public Integer getStatus() {
        return dataResponse.getStatus();
    }


    @Override
    public String getMessage() {
        return dataResponse.getMessage();
    }
}
